<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>Chat Rooms</title>
</head>
<body>
    <div>请输入聊天室名称</div>
	<br/>
    <input id="input" type="text" size="30"/>
	<br/>
    <input id="submit" type="button" value="进 入"/>

    <script>
        document.querySelector('#input').focus();
        document.querySelector('#input').onkeyup = function(e) {
            if (e.keyCode === 13) {  // enter, return
                document.querySelector('#submit').click();
            }
        };

        document.querySelector('#submit').onclick = function(e) {
            var roomName = document.querySelector('#input').value;
            window.location.pathname = '/' + roomName + '/';
        };
    </script>
</body>
</html>